import { toJS } from "mobx";
//将组件的数据进行处理 

let formData={};
export const getFormData=(data)=>{
  for(let key in data){
    if(typeof data[key] == "string"){
      formData[key] = data[key];
    }else if(typeof data[key] == "object"){
      if(data[key].length){
        let ids =[];
        for(let i in toJS(data[key])){
          ids.push(data[key][i].id);
        }
        formData[key] = ids.join(",");
      }else{
       getFormData(toJS(data[key]))
      }
    }
  }
  return formData;
}

